package cn.tedu.mall.front.controller;

import cn.tedu.mall.common.restful.JsonResult;
import cn.tedu.mall.front.service.IFrontSpuDetailService;
import cn.tedu.mall.pojo.product.vo.SpuDetailStandardVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class FrontSpuDetailController {
    @Autowired
    private IFrontSpuDetailService spuDetailService;

    /**
     * 利用spuId查询spuDetail
     */
    @GetMapping("/front/spu/detail/{spuId}")
    public JsonResult<SpuDetailStandardVO> selectSpuDetailBySpuId(
            @PathVariable("spuId") Long id) {
        SpuDetailStandardVO spuDetail = spuDetailService.getSpuDetail(id);
        return JsonResult.ok(spuDetail);
    }
}
